<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8" />
<title>健康指南资讯列表</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport"
	content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="./css/xadmin.css" th:href="@{/css/bootstrap.min.css}"  />
<link rel="stylesheet" href="./css/font.css" th:href="@{/css/font.css}" />
<link rel="stylesheet" href="./css/xadmin.css"	th:href="@{/css/xadmin.css}" />

<script type="text/javascript" src="/js/jquery.min.js"	th:src="@{/js/jquery.min.js}"></script>
<script src="./lib/layui/layui.js" charset="utf-8"	th:src="@{/lib/layui/layui.js}"></script>
<script type="text/javascript" src="./js/xadmin.js"	th:src="@{/js/xadmin.js}"></script>
<script type="text/javascript" src="./js/xadmin.js" th:src="@{/js/jqPaginator.js}"></script>        
</head>
<body>
	<!-- 顶部开始 -->
	<div class="container">
		<div class="logo">
			<a href="./index.html">运动处方后台管理</a>
		</div>
		<div class="left_open">
			<i title="展开左侧栏" class="iconfont">&#xe699;</i>
		</div>
        <ul class="layui-nav right" lay-filter="">
          <li class="layui-nav-item">
            <a href="javascript:;">admin</a>
            <dl class="layui-nav-child"> <!-- 二级菜单 -->
              <dd><a onclick="x_admin_show('个人信息','http://www.baidu.com')">修改密码</a></dd>
              <dd><a th:href="@{/layout}">退出</a></dd>
            </dl>
          </li>
          <li class="layui-nav-item to-index"><a href="/">前台首页</a></li>
        </ul>
        
    </div>

	<!-- 顶部结束 -->
	<!-- 中部开始 -->
	<!-- 左侧菜单开始 -->
	<div class="left-nav">
		<div id="side-nav">
			<ul id="nav"> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>会员管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/user/getList}"> <i class="iconfont"></i> <cite>会员列表</cite> </a></li> 
      </ul></li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>健康指南</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/artType/getList}"> <i class="iconfont"></i> <cite>分类列表</cite> </a></li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>资讯管理</cite> <i class="iconfont nav_right"></i> </a> 
        <ul class="sub-menu"> 
         <li><a th:href="@{/article/getList}"> <i class="iconfont"></i> <cite>资讯列表</cite> </a></li> 
         <li><a th:href="@{/artType/addArticle}"> <i class="iconfont"></i> <cite>资讯添加</cite> </a></li> 
        </ul></li> 
      </ul></li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>医师管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/doctorType/query}"> <i class="iconfont"></i> <cite>职业分类列表</cite> </a></li> 
       <li><a th:href="@{/doctor/getList}"> <i class="iconfont"></i> <cite>加入申请列表</cite> </a></li> 
       <li><a th:href="@{/doctor/toAdd}"> <i class="iconfont"></i> <cite>医师增加</cite> </a></li> 
       <li><a th:href="@{/doctor/query}"> <i class="iconfont"></i> <cite>医师列表</cite> </a></li> 
      </ul></li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>处方管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/illnessType/query}"> <i class="iconfont"></i> <cite>分类列表</cite> </a></li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>处方管理</cite> <i class="iconfont nav_right"></i> </a> 
        <ul class="sub-menu"> 
         <li><a th:href="@{/recipe/query}"> <i class="iconfont"></i> <cite>处方列表</cite> </a></li> 
         <li><a th:href="@{/recipe/toAdd}"> <i class="iconfont"></i> <cite>处方添加</cite> </a></li> 
        </ul></li> 
      </ul></li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>服务中心管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/area/query}"> <i class="iconfont"></i> <cite>区域列表</cite> </a></li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>服务中心管理</cite> <i class="iconfont nav_right"></i> </a> 
        <ul class="sub-menu"> 
         <li><a th:href="@{/serviceCenter/query}"> <i class="iconfont"></i> <cite>服务中心列表</cite> </a></li> 
         <li><a th:href="@{/serviceCenter/toAdd}"> <i class="iconfont"></i> <cite>服务中心添加</cite> </a></li> 
        </ul></li> 
      </ul></li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>订单管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/order/query}"> <i class="iconfont"></i> <cite>订单列表</cite> </a></li> 
      </ul></li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>banner图管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/img/query}"> <i class="iconfont"></i> <cite>banner图列表</cite> </a></li> 
       <li><a th:href="@{/img/toAdd}"> <i class="iconfont"></i> <cite>banner图添加</cite> </a></li> 
      </ul> </li> 
     <li><a href="javascript:;"> <i class="iconfont"></i> <cite>保险管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/insurance/query}"> <i class="iconfont"></i> <cite>保险列表</cite> </a></li> 
        <li><a th:href="@{/userreceive/getList}"> <i class="iconfont"></i> <cite>保险领取会员列表</cite> </a></li> 
       <li><a th:href="@{/insurance/toAdd}"> <i class="iconfont"></i> <cite>保险添加</cite> </a></li> 
       <li><a th:href="@{/insuranceDetail/toAdd?type=1}"> <i class="iconfont"></i> <cite>报销说明管理</cite> </a></li>
       <li><a th:href="@{/insuranceDetail/toAdd?type=2}"> <i class="iconfont"></i> <cite>福利说明管理</cite> </a></li>
      </ul> </li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>区块链管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
       <li><a th:href="@{/chain/toAdd}"> <i class="iconfont"></i> <cite>区块链管理</cite> </a></li> 
      </ul> </li> 
       <li><a href="javascript:;"> <i class="iconfont"></i> <cite>条款管理</cite> <i class="iconfont nav_right"></i> </a> 
      <ul class="sub-menu"> 
         <li><a th:href="@{/insuranceDetail/toAdd?type=3}"> <i class="iconfont"></i> <cite>使用条款管理</cite> </a></li>
       <li><a th:href="@{/insuranceDetail/toAdd?type=4}"> <i class="iconfont"></i> <cite>隐私权政策管理</cite> </a></li>
      </ul> </li> 
    </ul> 
		</div>
	</div>
	<!-- <div class="x-slide_left"></div> -->
	<!-- 左侧菜单结束 -->
	<!-- 右侧主体开始 -->
	<div class="page-content">
		<div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
			<!--  <ul class="layui-tab-title">
            <li>我的桌面</li>
          </ul> -->
          <div class="layui-tab-content" style="margin-top: -30px;">
            <div class="layui-tab-item layui-show" style="overflow: scroll;">
           		<div class="x-nav">
			      <span class="layui-breadcrumb">
			        <a href="">首页</a>
			        <a href="">健康指南</a>
			        <a>
			          <cite>健康指南资讯列表</cite></a>
			      </span>
			      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
			        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
			    </div>
			   
			    <div class="x-body">
			     <div class="layui-row">
			        <form class="layui-form layui-col-md12 x-so" method="post" th:action="@{/article/getList}">
			          <div class="layui-input-inline">
			            <select name="typeId" id="type">
			              <option value="0" th:selected="${artMap.typeId}==0">全部分类</option>
			              <option th:each="ty:${artMap.typeList}" th:value="${ty.id}" th:text="${ty.name}" th:selected="${artMap.typeId==ty.id}">全部分类</option>
			            </select>
			          </div>
			          <button class="layui-btn"  lay-submit=""  lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
			        </form>
			      </div>
			      <table class="layui-table">
			        <thead>
			          <tr>
			           <th>ID</th>
			           <th>分类名</th>
			           <th>展示图片</th>
			           <th>标题</th>
			           <th>创建时间</th>
			           <th>是否推荐</th>
			           <th>操作</th>
			      	</tr>
			        </thead>
			        <tbody>
			          <tr th:each="art,teaStar:${artMap.data}">
			            <td th:text="${teaStar.index+1}">1</td>
			            <td th:text="${art.name}">小明</td>
			            <td><img alt="" th:src="${artMap.tempContextUrl+art.img_url}" width="100px" height="80px" onerror="this.src='/images/default.png'" /></td>
			            <td th:text="${art.title}">小明</td>
			            <td th:text="${art.create_time}">小明</td>
			            <td th:if="${art.is_recommend}==1"  class="td-status">
			            <span class="layui-btn layui-btn-normal layui-btn-mini">
			            	<p th:id="status+${art.id}">已推荐</p>
						</span>
			            </td>
			            <td th:if="${art.is_recommend}==0"  class="td-status"><span class="layui-btn layui-btn-normal layui-btn-mini layui-btn-disabled">
			            	<p th:id="status+${art.id}">未推荐</p>
			            </span></td>
			            <td class="td-manage">
			             <a  th:onclick="'javascript:member_stop(this,\''+${art.id}+'\');'" href="javascript:;"  title="更改状态">
			                <i class="layui-icon">&#xe601;</i>
			              </a>
			               <a title="编辑"  th:href="@{/article/artcDateils(id=${art.id})}">
			                <i class="layui-icon">&#xe642;</i>
			              </a>
			              <a title="删除" th:onclick="'javascript:member_del(this,\''+${art.id}+'\');'"  href="javascript:;">
			                <i class="layui-icon">&#xe640;</i>
			              </a>
			            </td>
			          </tr>
			        </tbody>
			      </table>
			      <div class="page">
			        <p id="p"></p>
				    <div id="pagination">
					</div>
			      </div>
			
			    </div>
            </div>
          </div>
        </div>
    </div>
    <div class="page-content-bg"></div>
    <!-- 右侧主体结束 -->
    <!-- 中部结束 -->
    <!-- 底部开始 -->
    <div class="footer">
        <div class="copyright">Copyright ©2017 x-admin v2.3 All Rights Reserved</div>  
    </div>
 <script th:inline="javascript">
    /*<![CDATA[*/
    	$(function(){
    		var name=$("#type").val();
    	    $.jqPaginator('#pagination', {
    	        totalPages: [[${artMap.totalPages}]],
    	        visiblePages: 10,
    	        currentPage: [[${artMap.pageIndex}]],
    	        wrapper:'<ul class="pagination"></ul>',
    	        first: '<li class="first"><a href="/article/getList?pageIndex=1&typeId='+name+'">第一页</a></li>',
    	        prev: '<li class="prev"><a href="/article/getList?pageIndex='+[[${artMap.pageIndex-1}]]+'&typeId='+name+'">上一页</a></li>',
    	        next: '<li class="next"><a href="/article/getList?pageIndex='+[[${artMap.pageIndex+1}]]+'&typeId='+name+'">下一页</a></li>',
    	        last: '<li class="last"><a href="/article/getList?pageIndex='+[[${artMap.totalPages}]]+'&typeId='+name+'">最后页</a></li>',
    	        page: '<li class="page"><a href="/article/getList?pageIndex={{page}}&typeId='+name+'">{{page}}</a></li>',
    	        onPageChange: function (num) {
    	            //$('#p').text(num);
    	        	var total=[[${artMap.totalPages}]];
    	        	var pageIndex=[[${artMap.pageIndex}]];
    	            if(pageIndex==1){
    	            	$('.first a').attr('href','javascript:;;');//去掉标签中的onclick事件
    	            	$('.prev a').attr('href','javascript:;;');//去掉标签中的onclick事件
    	            }
    	            if(pageIndex==total){
    	            	$('.next a').attr('href','javascript:;;');//去掉标签中的onclick事件
    	            	$('.last a').attr('href','javascript:;;');//去掉标签中的onclick事件
    	            }
    	        }
    	    });
    	});
    	
    /*]]>*/
    </script>
    
    <script>

      /*用户-删除*/
      function member_del(obj,id){
          layer.confirm('确认要删除吗？',function(index){
              //发异步删除数据
              $.ajax({
				    url:'/article/delArtc',
				    type:'GET', //GET
				    async:true,    //或false,是否异步
				    data:{
				    	id:id
				    },
				    timeout:5000,    //超时时间
				    dataType:'text',    //返回的数据格式：json/xml/html/script/jsonp/text
				    success:function(data,textStatus,jqXHR){
				    	if(data>0){
				    		 $(obj).parents("tr").remove();
				              layer.msg('已删除!',{icon:1,time:1000});
				    	}else{
				    		 layer.msg('删除失败!',{icon:5,time:1000});
				    	}
				    }
				});

             
          });
      }
      
      function member_stop(obj,id){
          layer.confirm('确认要更改吗？',function(index){
              if($("#status"+id).text()=='已推荐'){
				
                //发异步把用户状态进行更改
                 $.ajax({
				    url:'/article/updateStatus',
				    type:'GET', //GET
				    async:true,    //或false,是否异步
				    data:{
				    	id:id,
				    	status:"0"
				    },
				    timeout:5000,    //超时时间
				    dataType:'text',    //返回的数据格式：json/xml/html/script/jsonp/text
				    success:function(data,textStatus,jqXHR){
				    	if(data>0){
				                $(obj).find('i').html('&#xe62f;');

				                $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled');
				                $("#status"+id).text("未推荐");
				                layer.msg('已取消!',{icon: 5,time:1000});
				    	}else{
				    		 layer.msg('取消失败!',{icon:1,time:1000});
				    	}
				    }
				});
               

              }else{
            	  $.ajax({
  				    url:'/article/updateStatus',
  				    type:'GET', //GET
  				    async:true,    //或false,是否异步
  				    data:{
  				    	id:id,
  				    	status:"1"
  				    },
  				    timeout:5000,    //超时时间
  				    dataType:'text',    //返回的数据格式：json/xml/html/script/jsonp/text
  				    success:function(data,textStatus,jqXHR){
  				    	if(data>0){
  			                $(obj).find('i').html('&#xe60c;');

  			                $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled');
  			              $("#status"+id).text("已推荐");
  			                layer.msg('已推荐!',{icon: 1,time:1000});
  				    	}else{
  				    		 layer.msg('推荐失败!',{icon:5,time:1000});
  				    	}
  				    }
  				});
               
              }
              
          });
      }

    </script>
</body>
</html>